home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEMP
/
GNU
/
bison
/
RPNCalc
< prev
next >
Wrap
Text File
|
1995-06-28
|
1KB
|
25 lines
RPN Calc
Previous: <Examples=>Examples> * Next: <Infix Calc=>InfixCalc> * Up: <Examples=>Examples>
#Wrap on
{fH3}Reverse Polish Notation Calculator{f}
The first example is that of a simple double-precision {fUnderline}reverse polish
notation{f} calculator (a calculator using postfix operators). This example
provides a good starting point, since operator precedence is not an issue.
The second example will illustrate how operator precedence is handled.
The source code for this calculator is named {fCite}rpcalc.y{f}. The
{fEmphasis}.y{f} extension is a convention used for Bison input files.
#Wrap off
<Decls=>RpcalcDecl>: Bison and C declarations for rpcalc.
<Rules=>RpcalcRule>: Grammar Rules for rpcalc, with explanation.
<Lexer=>RpcalcLexe>: The lexical analyzer.
<Main=>RpcalcMain>: The controlling function.
<Error=>RpcalcErro>: The error reporting function.
<Gen=>RpcalcGen>: Running Bison on the grammar file.
<Comp=>RpcalcComp>: Run the C compiler on the output code.
#Wrap on